import { cookies } from "next/headers";
export const dynamic = "force-static";
export const revalidate = 60
export async function GET(request: Request) {
    const res = await fetch("http://localhost:3000/test.json", {
        headers: new Headers({
            "Content-Type": "application/json",
            "API-Key": process.env.DATA_API_KEY || "",
        }),
    });
    const data = await res.json();
    const cookieStore = await cookies();
    const token = cookieStore.get("token");

    return Response.json(
        { message: "Hello, Next.js!", data },
        {
            status: 200,
            headers: { "Set-Cookie": `token=${token?.value}` },
        }
    );
}
